<?xml version='1.0' encoding='UTF-8' ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html 
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:p="http://primefaces.org/ui">


    <h:head>
        <link rel="stylesheet" type="text/css" href="media/css/style.css" />
        <link rel="stylesheet" type="text/css" href="media/css/css.css" />
        <link rel="stylesheet" type="text/css" href="media/styles/grid.css"  />
        <title>Atlas</title>
        <!-- CSS -->
        <link rel="stylesheet" href="media/css/reset.css"/>
        <link rel="stylesheet" href="media/css/animate.css"/>
        <link rel="stylesheet" href="media/css/styles.css"/>
    </h:head> 

    <h:body>
        <!-- Begin Page Content -->
        <p:growl id="messages" autoUpdate="true" /> 
       

        <div id="container" style="height: 58%;">

            <h:form id="loginForm">

                <h3 class="title">Pesquisa do Contribuinte</h3>
                <br/>
                <p:panel id="inscPanel" style="background: none; border: none;" 
                         styleClass="container_24 clearfix">
                    <p:outputLabel value="Inscrição: " styleClass="grid_6" />
                    <div class="clear"/>
                    <p:inputMask id="maskinscricao" mask="?99.99.999.9999.99" required="true"  
                                 value="#{managerContribuinte.inscricao}" styleClass="grid_18" />
                    <p:watermark value="DD.SS.QUADR.LOTE.UN" for="maskinscricao" />
                </p:panel>

                <p:panel id="docPanel" style="background: none; border: none;" 
                         styleClass="container_24 clearfix">

                    <p:selectOneRadio id="typePerson" 
                                      value="#{managerContribuinte.proprietario.tipoDocumento}" >  
                        <f:selectItems value="#{managerContribuinte.tipoDocumento()}" />
                        <p:ajax event="change" update=":loginForm:docPanel" />
                    </p:selectOneRadio>

                    <f:validateBean disabled="true">
                        <p:inputMask id="typeDocumentInput" 
                                     value="#{managerContribuinte.proprietario.tipoDocumento.tipo eq 'CPF' ? 
                                              managerContribuinte.proprietario.cpf : managerContribuinte.proprietario.cnpj}"
                                     mask="#{managerContribuinte.proprietario.tipoDocumento.tipo eq 'CPF' ? 
                                             '999.999.999-99':'99.999.999/9999-99'}" required="true"   
                                     styleClass="grid_18" > 

                        </p:inputMask>
                    </f:validateBean>
                </p:panel>


                <div class="buttonAction">
                    <p:commandButton value="Pesquisar" update="@form" process="@form"
                                     actionListener="#{managerContribuinte.logar()}" 
                                     style="font-size: 14px;"/>
                </div>

            </h:form>

        </div><!--/ container-->

    </h:body>
</html>